package com.ydch.spring.test.queue;

import java.util.concurrent.BlockingQueue;

public class MessageCustomerThread extends Thread {

	
	private BlockingQueue<Object> queue = null;
	private boolean isRunning = true;
	public void getMessage() {
		BlockingQueueMessage blockingQueueMessage = (BlockingQueueMessage) SpringUtils  
                .getContext().getBean("blockingQueueMessage");  
        queue = blockingQueueMessage.queue;  
		while (isRunning) {
			System.out.println("队列大小：" + queue.size());
			System.out.println("正从队列获取数据...");
			String data = (String) queue.poll();
			if (null != data) {
				System.out.println("正在消费数据：" + data);
			}
		}
	}
}
